import Vue from "vue";
import Vuex from "vuex";
import createPersistedState from "vuex-persistedstate";

Vue.use(Vuex);

export default new Vuex.Store({
  state: {
    // 用户信息
    personInfo: {},
    // top菜单,刷新默认选中，需要存vuex
    menuActive: {},
    // 面包屑数组
    routerActive: [],
    gnList: []
  },
  mutations: {
    SET_PERSONINFO(state, data) {
      state.personInfo = data;
    },
    SET_MENUACTIVE(state, data) {
      state.menuActive = data;
    },
    SET_ROUTERACTIVE(state, data) {
      state.routerActive = data;
    },
    SET_GNLIST(state, data) {
      state.gnList = data;
    }
  },
  actions: {},
  modules: {},
  plugins: [
    createPersistedState({
      storage: window.sessionStorage
    })
  ]
});
